package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcResource;
import com.visizen.wisdomclass.server.model.WcResourceExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcResourceMapper {
    @SelectProvider(type=WcResourceSqlProvider.class, method="countByExample")
    int countByExample(WcResourceExample example);

    @DeleteProvider(type=WcResourceSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcResourceExample example);

    @Delete({
        "delete from wc_resource",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long ID);

    @Insert({
        "insert into wc_resource (ID, WORD, ",
        "AUTHOR, IMAGE_ID, ",
        "UP_TIME, CONTANT)",
        "values (#{ID,jdbcType=BIGINT}, #{WORD,jdbcType=VARCHAR}, ",
        "#{AUTHOR,jdbcType=VARCHAR}, #{IMAGE_ID,jdbcType=BIGINT}, ",
        "#{UP_TIME,jdbcType=TIMESTAMP}, #{CONTANT,jdbcType=LONGVARCHAR})"
    })
    int insert(WcResource record);

    @InsertProvider(type=WcResourceSqlProvider.class, method="insertSelective")
    int insertSelective(WcResource record);

    @SelectProvider(type=WcResourceSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="ID", property="ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="WORD", property="WORD", jdbcType=JdbcType.VARCHAR),
        @Result(column="AUTHOR", property="AUTHOR", jdbcType=JdbcType.VARCHAR),
        @Result(column="IMAGE_ID", property="IMAGE_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="UP_TIME", property="UP_TIME", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="CONTANT", property="CONTANT", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<WcResource> selectByExampleWithBLOBs(WcResourceExample example);

    @SelectProvider(type=WcResourceSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="WORD", property="WORD", jdbcType=JdbcType.VARCHAR),
        @Result(column="AUTHOR", property="AUTHOR", jdbcType=JdbcType.VARCHAR),
        @Result(column="IMAGE_ID", property="IMAGE_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="UP_TIME", property="UP_TIME", jdbcType=JdbcType.TIMESTAMP)
    })
    List<WcResource> selectByExample(WcResourceExample example);

    @Select({
        "select",
        "ID, WORD, AUTHOR, IMAGE_ID, UP_TIME, CONTANT",
        "from wc_resource",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="ID", property="ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="WORD", property="WORD", jdbcType=JdbcType.VARCHAR),
        @Result(column="AUTHOR", property="AUTHOR", jdbcType=JdbcType.VARCHAR),
        @Result(column="IMAGE_ID", property="IMAGE_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="UP_TIME", property="UP_TIME", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="CONTANT", property="CONTANT", jdbcType=JdbcType.LONGVARCHAR)
    })
    WcResource selectByPrimaryKey(Long ID);

    @UpdateProvider(type=WcResourceSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcResource record, @Param("example") WcResourceExample example);

    @UpdateProvider(type=WcResourceSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") WcResource record, @Param("example") WcResourceExample example);

    @UpdateProvider(type=WcResourceSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcResource record, @Param("example") WcResourceExample example);

    @UpdateProvider(type=WcResourceSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcResource record);

    @Update({
        "update wc_resource",
        "set WORD = #{WORD,jdbcType=VARCHAR},",
          "AUTHOR = #{AUTHOR,jdbcType=VARCHAR},",
          "IMAGE_ID = #{IMAGE_ID,jdbcType=BIGINT},",
          "UP_TIME = #{UP_TIME,jdbcType=TIMESTAMP},",
          "CONTANT = #{CONTANT,jdbcType=LONGVARCHAR}",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKeyWithBLOBs(WcResource record);

    @Update({
        "update wc_resource",
        "set WORD = #{WORD,jdbcType=VARCHAR},",
          "AUTHOR = #{AUTHOR,jdbcType=VARCHAR},",
          "IMAGE_ID = #{IMAGE_ID,jdbcType=BIGINT},",
          "UP_TIME = #{UP_TIME,jdbcType=TIMESTAMP}",
        "where ID = #{ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WcResource record);
}